Package com.fsf.news.repository
Class NewsRepositoryTest
java.lang.Object
com.fsf.news.repository.NewsRepositoryTest
@ExtendWith(GuiceExtension.class) @ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class)
class NewsRepositoryTest
extends Object
Unit tests for the NewsRepository class.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.fasterxml.jackson.databind.ObjectMapper(package private) com.fsf.news.repository.NewsRepository -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidTests that the findAll method returns the expected search results when available.(package private) voidTests that the findAllArticles method returns the expected articles when available.(package private) voidTests that the findAllArticles method returns an empty list when searching for articles in a different session.(package private) voidTests that the findAllArticles method returns an empty list when no articles are available.(package private) voidTests that the findAll method returns the expected search results when the maximum capacity is exceeded.(package private) voidTests that the findAll method returns an empty list when searching for search results in a different session.(package private) voidTests that the findAll method returns an empty list when no search results are available.(package private) voidTests that the findAll method returns the expected search results when the maximum capacity is reached.(package private) voidTests that the findByUuid method returns the expected search result when available.(package private) voidTests that the findByUuid method returns an empty optional when searching for a search result in a different session.(package private) voidTests that the findByUuid method returns an empty optional when no search result is available.(package private) voidtestSave()Tests that the save method adds a search result and returns the expected search result.
-
Field Details
-
objectMapper
@Inject @Named("objectMapperJSON") com.fasterxml.jackson.databind.ObjectMapper objectMapper -
repository
@InjectMocks com.fsf.news.repository.NewsRepository repository
-
-
Constructor Details
-
NewsRepositoryTest
NewsRepositoryTest()
-
-
Method Details
-
testFindByUuidEmpty
@Test void testFindByUuidEmpty()Tests that the findByUuid method returns an empty optional when no search result is available. -
testFindByUuid
@Test void testFindByUuid()Tests that the findByUuid method returns the expected search result when available. -
testFindByUuidDifferentSession
@Test void testFindByUuidDifferentSession()Tests that the findByUuid method returns an empty optional when searching for a search result in a different session. -
testFindAllEmpty
@Test void testFindAllEmpty()Tests that the findAll method returns an empty list when no search results are available. -
testFindAll
@Test void testFindAll()Tests that the findAll method returns the expected search results when available. -
testFindAllDifferentSession
@Test void testFindAllDifferentSession()Tests that the findAll method returns an empty list when searching for search results in a different session. -
testFindAllMaxCapacity
@Test void testFindAllMaxCapacity()Tests that the findAll method returns the expected search results when the maximum capacity is reached. -
testFindAllBeyondCapacity
@Test void testFindAllBeyondCapacity()Tests that the findAll method returns the expected search results when the maximum capacity is exceeded. -
testFindAllArticlesEmpty
@Test void testFindAllArticlesEmpty()Tests that the findAllArticles method returns an empty list when no articles are available. -
testFindAllArticles
Tests that the findAllArticles method returns the expected articles when available.- Throws:
IOException- If an I/O error occurs
-
testFindAllArticlesDifferentSession
Tests that the findAllArticles method returns an empty list when searching for articles in a different session.- Throws:
IOException- If an I/O error occurs
-
testSave
@Test void testSave()Tests that the save method adds a search result and returns the expected search result.
-